from common import RpcStatus

# 响应码的键
CODE_KEY = "code"
# 响应消息的键
MESSAGE_KEY = "msg"
# 响应数据体的键
DATA_KEY = "data"


def success(data):
    return {CODE_KEY: RpcStatus.SUCCESS_CODE, MESSAGE_KEY: "", DATA_KEY: data}


def failure(msg):
    return {CODE_KEY: RpcStatus.FAILURE_CODE, MESSAGE_KEY: msg}


def response(code, msg, data):
    return {CODE_KEY: code, MESSAGE_KEY: msg, DATA_KEY: data}


def response_no_data(code, msg):
    return {CODE_KEY: code, MESSAGE_KEY: msg, DATA_KEY: ""}
